import random

before_num_list = list(range(1, 34))
after_num_list = list(range(1, 17))

# 随机产生一注彩票
win_num_list = list()
user_num_list = list()
while len(win_num_list) < 6:
    random_num = random.randint(1, 33)
    if random_num not in win_num_list:
        win_num_list.append(random_num)
win_num_list.append(random.randint(1, 16))
print(win_num_list)
# 用户购买彩票
while len(user_num_list) < 6:
    user_num = int(input('请输入第%d个1~33之间的号码' % (len(user_num_list) + 1)))
    if 0 < user_num <= 33 and user_num not in user_num_list:
        user_num_list.append(user_num)
    else:
        print('输入有误，请重新输入')
while True:
    user_num = int(input('请输入最后一个1~16的数'))
    if 0 < user_num <= 16:
        user_num_list.append(user_num)
        break

user_num_str = "-".join('%s' % item for item in user_num_list)
win_num_str = "-".join('%s' % item for item in win_num_list)
if win_num_list == user_num_list:
    print('您购买的号码是%s,中奖号码是%s。恭喜您，您中奖了' % (user_num_str, win_num_str))
else:
    print('您购买的号码是%s,中奖号码是%s。很遗憾，您没有中奖' % (user_num_str, win_num_str))
